package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
load("//tools:defaults.bzl", "ng_e2e_test_library", "ng_module", "ng_test_library", "ng_web_test_suite", "ts_library")
load("//src/e2e-app:test_suite.bzl", "e2e_test_suite")

ng_module(
    name = "mdc-checkbox",
    srcs = glob(
        ["**/*.ts"],
        exclude = [
            "**/*.spec.ts",
            "harness/**",
        ],
    ),
    assets = [":checkbox_scss"] + glob(["**/*.html"]),
    module_name = "@angular/material-experimental/mdc-checkbox",
    deps = [
        "//src/cdk/coercion",
        "//src/cdk/platform",
        "//src/material/checkbox",
        "//src/material/core",
        "@npm//@angular/animations",
        "@npm//@angular/common",
        "@npm//@angular/core",
        "@npm//@angular/forms",
        "@npm//@material/checkbox",
    ],
)

ts_library(
    name = "harness",
    srcs = glob(
        ["harness/**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
    deps = [
        "//src/cdk-experimental/testing",
        "//src/cdk/coercion",
    ],
)

sass_library(
    name = "mdc_checkbox_scss_lib",
    srcs = glob(["**/_*.scss"]),
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "checkbox_scss",
    src = "checkbox.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
        "//src/material/core:all_themes",
    ],
)

ng_test_library(
    name = "checkbox_tests_lib",
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = ["**/*.e2e.spec.ts"],
    ),
    deps = [
        ":harness",
        ":mdc-checkbox",
        "//src/cdk-experimental/testing",
        "//src/cdk-experimental/testing/testbed",
        "//src/cdk/testing",
        "//src/material/checkbox",
        "@npm//@angular/forms",
        "@npm//@angular/platform-browser",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    static_files = ["@npm//:node_modules/@material/checkbox/dist/mdc.checkbox.js"],
    deps = [
        ":checkbox_tests_lib",
        "//src/material-experimental:mdc_require_config.js",
    ],
)

ng_e2e_test_library(
    name = "e2e_test_sources",
    srcs = glob(["**/*.e2e.spec.ts"]),
    deps = [
        "//src/cdk/testing/e2e",
    ],
)

e2e_test_suite(
    name = "e2e_tests",
    deps = [
        ":e2e_test_sources",
        "//src/cdk/testing/e2e",
    ],
)
